#pragma once

#include <sstream>
#include <stdexcept>

#include "TokenKinds.h"
#include "dev_assert.h"

namespace cal
{

class Exception : public std::exception
{
public:
    Exception() = default;
    Exception(const std::string& msg) :_msg{ msg } {}
    virtual ~Exception() = default;

public:
    virtual const char* what() const noexcept override { return _msg.c_str(); }

protected:
    std::string _msg;
};

#define THROW_LACK_OF_OPERATOR(kind) \
    throw cal::Exception{"lack of " + get_token_name(kind) + ": '" + get_operator_spelling_str(kind) + "'"}

}   // namespace cal
